/**
 * 清除数组中重复数据
 * @param arr
 * @param key
 * @returns
 */
export const removeDuplicate = (arr: any[], key = 'id') =>
  arr.filter((v, i, a) => a.findIndex((v2) => v2?.[key] === v?.[key]) === i);

/**
 * 判断是否在微信小程序中
 * @returns
 */
export const inWxMiniProgram = () =>
  window?.__wxjs_environment === 'miniprogram' ||
  navigator.userAgent.toLowerCase().indexOf('miniprogram') != -1;

/**
 * 判断是否在安卓中
 * @returns
 */
export const isAnroid = () =>
  navigator.userAgent.indexOf('Android') > -1 || navigator.userAgent.indexOf('Adr') > -1;
